<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	template="/templates/general.xhtml">

	<ui:define name="title">
		<h:outputText value="#{menu['user.congresses.new']}" />
	</ui:define>
	<ui:define name="content">
		<h:form prependId="false">
			<p:panel id="newCongressPanel">
				<h:panelGrid columns="2" cellpadding="5">
					<h:outputLabel for="name" value="#{domain['congress.name']}" />
					<p:inputText value="#{newCongressBean.congress.name}" id="name"
						required="true" />

					<h:outputLabel for="location"
						value="#{domain['congress.location']}" />
					<p:autoComplete value="#{newCongressBean.congress.location}"
						id="location" queryDelay="500"
						completeMethod="#{newCongressBean.newLocation}" required="true" />

					<h:outputLabel for="matter" value="#{domain['congress.matter']}" />
					<p:inputText value="#{newCongressBean.congress.matter}" id="matter"
						required="true" />

					<h:outputLabel for="url" value="#{domain['congress.url']}" />
					<p:inputText value="#{newCongressBean.congress.url}" id="url"
						validator="#{newCongressBean.validateUrl}" />
						
					<h:outputLabel for="email" value="#{domain['congress.email']}" />
					<p:inputText value="#{newCongressBean.congress.email}" id="email" required="true" validatorMessage="#{msgs['emailIncorrect']}">
						<f:validateRegex
							pattern="^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$" />
					</p:inputText>

					<h:outputLabel for="comments"
						value="#{domain['congress.comments']}" />
					<p:inputTextarea value="#{newCongressBean.congress.comments}"
						id="comments" effectDuration="400" />

					<h:outputLabel for="opening" value="#{domain['congress.opening']}" />
					<p:calendar value="#{newCongressBean.congress.opening}"
						required="true" id="opening" pattern="dd/MM/yyyy" />

					<h:outputLabel for="closure" value="#{domain['congress.closure']}" />
					<p:calendar value="#{newCongressBean.congress.closure}"
						required="true" id="closure" pattern="dd/MM/yyyy" />
					
					<h:outputLabel for="callForPapers"
						value="#{domain['congress.callForPapers']}" />
					<p:calendar value="#{newCongressBean.congress.callForPapers}"
						id="callForPapers" pattern="dd/MM/yyyy" />

					<h:outputLabel for="callForParticipation"
						value="#{domain['congress.callForParticipation']}" />
					<p:calendar
						value="#{newCongressBean.congress.callForParticipation}"
						id="callForParticipation" pattern="dd/MM/yyyy" />

					<h:outputLabel for="actSelect" value="#{domain['congress.act']}" />
					<p:selectOneListbox value="#{newCongressBean.congress.act}"
						id="actSelect" required="true">
						<f:selectItems value="#{newCongressBean.acts}" var="act"
							itemLabel="#{act.label}" itemValue="#{act}">
						</f:selectItems>
					</p:selectOneListbox>
					
					<h:outputLabel for="impSelect" value="#{domain['congress.importance']}" />
					<p:selectOneListbox value="#{newCongressBean.congress.importance}"
						id="impSelect" required="true">
						<f:selectItems value="#{newCongressBean.importances}" var="importance"
							itemLabel="#{importance.label}" itemValue="#{importance}">
						</f:selectItems>
					</p:selectOneListbox>
					
					<h:outputLabel for="recSelect" value="#{domain['congress.recurrence']}" />
					<p:selectOneListbox value="#{newCongressBean.congress.recurrence}"
						id="recSelect" required="false">
						<f:selectItems value="#{newCongressBean.recurrences}" var="recurrence"
							itemLabel="#{recurrence.label}" itemValue="#{recurrence}">
						</f:selectItems>
					</p:selectOneListbox>

				</h:panelGrid>
			</p:panel>
			<p:commandButton update="newCongressPanel" type="submit" id="save"
				styleClass="float_right" actionListener="#{newCongressBean.save}"
				image="ui-icon ui-icon-disk" value="#{msgs['save']}" />

		</h:form>

	</ui:define>

</ui:composition>